<template>
  <div>
    <el-dialog
      title="展示详情"
      :visible.sync="dialogVisible"
      width="40%"
      center
      :before-close="handleClose">
      <el-card v-loading="loading">
        <el-form :model="user" status-icon label-width="100px">
          <el-form-item label="姓名">
            <el-input v-model="user.name" autocomplete="off" disabled></el-input>
          </el-form-item>
          <el-form-item label="住址">
            <el-input v-model="user.address" autocomplete="off" disabled></el-input>
          </el-form-item>
        </el-form>
      </el-card>
      <div slot="footer" class="dialog-footer">
        <el-button @click="handleClose">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import IdManager from "@/api/dataManage/IdManager";

export default {
  name: "detail_user",
  props: {
    user: Object
  },
  data() {
    return {
      dialogVisible: true,
      loading: false,

    }
  },
  created() {
    this.init();
  },
  methods: {
    //初始化数据
    init() {
      const api = new IdManager();
      this.loading = true
      api.findByOne(this.user.id).then(res => {
        this.loading = false
      }).catch(()=>this.loading=false)
    },

    handleClose() {
      this.$emit("close", {name: 'detail', isRefresh: false});
    },
  }
}

</script>

<style scoped>

</style>
